<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./http.js"></script>
    <style>
        body {
            text-align: center;
        }
    </style>
</head>

<body>
    <h1>登录</h1>
    <p class="p1">账号：<input type="text"></p>
    <p class="p2">密码：<input type="password"></p>
    <button>登录</button>
    <script>
        let text = document.querySelector('.p1 input');
        let password = document.querySelector('.p2 input');
        let btn = document.querySelector('button');
        btn.addEventListener('click', function () {
            let obj = { account: `${text.value}`, password: `${password.value}` };
            http.post('http://139.9.177.51:8099/users/login', obj, function (res) {
                if (res.status == 0) {
                    alert('登录成功')
                } else {
                    alert('登录失败')
                }
            })
        })
    </script>
</body>

</html>